<?php
class A {
    public $_xxx;
    public function func1(){
        return $this->_xxx = "xxxx";
//        return $this;
    }
    public function func2(){
        echo $this->_xxx;
    }
}

class B{
    public function ff(){
        return new A();
    }
}
//$a = new A();
//echo $a->func1()->func2();
$b = new B();
echo $b->ff()->func1()->func2();
?>